package com.lengxf.pay.ali.config;


import com.lengxf.pay.common.config.TransactionType;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@Getter
@AllArgsConstructor
public enum ALI_TransactionType implements TransactionType {


    /**
     * 手机网站支付
     */
    WAP(),

    /**
     * web网站支付
     */
    WEB(),

    /**
     * APP支付
     */
    APP(),

    /**
     * 订单查询
     */
    QUERY(),

    /**
     * 退款
     */
    REFUND(),

    /**
     * 退款查询
     */
    REFUND_QUERY(),
    ;

    public static ALI_TransactionType toEnum(String payWay) {
        return Arrays.stream(ALI_TransactionType.values())
                .filter(e -> e.toString().equalsIgnoreCase(payWay))
                .findFirst()
                .orElseThrow(() -> new RuntimeException("未找到匹配的支付宝交易类型"));
    }

}
